#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

const int N = 14, M = 1 << 12, mod = 1e8;

int dp[N][M];
int n, m;
int g[N][N];
vector<int> state;
bool check(int u)
{
    for (int i = 0; i < m; i ++)
        if ((u >> i & 1) && (u >> i + 1 & 1))
            return false;
    return true;
}

bool solution(int u, int row)
{
    for (int i = 1; i <= m; i++ )
    {
        int c = u >> (m - i) & 1;
        if ((g[row][i] == 0) && (c == 1))
            return false;
    }
    return true;
}

int main()
{
    cin >> n >> m;
    for (int i = 1; i <= n; i ++ )
        for (int j = 1; j <= m; j ++ )
            cin >> g[i][j];

    // 预处理 符合要求的数据 也就是 二进制数 没有连在一起的数据
    for (int i = 0; i < 1 << m; i ++ )
        if (check(i))
            state.push_back(i);

    dp[0][0] = 1;
    for (int i = 1; i <= n + 1; i ++)
        for (auto& a : state)
            for (auto& b : state)
                // 如果i行的土地上以状态a符合要求 且 i - 1行土地能以b的状态 
                if (solution(a, i) && solution(b, i - 1) && ((a & b) == 0))
                    dp[i][a] = (dp[i][a] + dp[i - 1][b]) % mod;
    
    int res = 0;
    cout << dp[n + 1][0] << endl;
    return 0;
}